<?php

require_once 'Core/Db/Table/Abstract.php';
require_once 'Core/Db/Table/Row/Abstract.php';
require_once 'Core/Db/Table/Rowset/Abstract.php';

class Nld_Models_Users_Row extends Core_Db_Table_Row_Abstract
{
	public function _doInsert()
	{
		$this->salt 		= Core_Helper_String::random_string('alnum', 4);
		$this->password = md5($this->password.$this->salt);

		return parent::_doInsert();
	}
	public function _doUpdate()
	{
		$password         = $this->password;
		if(empty($password))
		{
			unset($this->_modifiedFields[$this->_transformColumn('password')]);
		}
		else
		{
			$this->password = md5($password.$this->salt);
		}
		return parent::_doUpdate();
	}
}